package com.cskaoyan.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author by WANGJun
 * @date 2022/6/9 17:21
 */
public class OrderSnUtil {
    public static String getOrderSn(Integer userId){
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        String orderSn = simpleDateFormat.format(date);
        String time = String.valueOf(date.getTime());
        int length = 16 - userId.toString().length()-8;
        orderSn = orderSn + userId + time.substring(time.length()-length-1);
        return orderSn;
    }
}
